/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Xadrez.Modelo;

/**
 *
 * @author Jéssica
 */
public abstract class Piece implements Cloneable{

    private String color;
    private boolean firstMove;
    private boolean enPassant;

    public Piece() 
    {

    }

    // <editor-fold defaultstate="collapsed" desc="Metodos Get e Set">
    public String getColor() {
        return this.color;
    }

    public void setColor(String c) {
        this.color = c;
    }

    public void setFirstMove(boolean b){
        this.firstMove = b;
    }

    public boolean getEnPassant(){
        return this.enPassant;
    }


    public void setEnPassant(boolean b){
        this.enPassant = b;
    }
    // </editor-fold>

    public boolean isValidMove(Move m, Board board) {
        return true;

    }
    public boolean move(Move m, Board board){

        boolean done = false;

        if (isValidMove(m, board)) {
            m.getDestination().setPiece(this);
            m.getOrigin().setPiece(null);
            if(firstMove) firstMove = false;
            done = true;

        }
        return done;
 
    }

    public String toString(){
  //      System.out.println("peça " + color);
        return "peça";
    }

    public boolean isFirstMove(){
        return this.firstMove;
    }

    public Object clone() {
        try {
            Piece outra = (Piece) super.clone();
            //Aqui você incializa as suas propriedades.
            return outra;
        } catch (CloneNotSupportedException e) {
            return null; // nunca chamado
        }
    }

}
